﻿using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace ZQNB.Common.Web
{
    /// <summary>
    /// 一个来自客户端的请求
    /// 发生在ActionExecuting时
    /// </summary>
    public class NbMvcRequest
    {
        ////const
        //public const string Key = "NbMvcRequest";
        ////迟加载，同一个请求管道中，第一次访问进行计算，后面使用缓存

        public NbMvcRequest() : this("", "", "", "", "", "", "") { }

        public NbMvcRequest(string identityName, string domainUri,string site, string area, string controller, string action, string owner)
        {
            IdentityName = identityName ?? "";
            DomainUri = domainUri ?? "";
            Site = site ?? "";
            Area = area ?? "";
            Controller = controller ?? "";
            Action = action ?? "";
            Owner = owner ?? "";
        }

        public string Area { get; set; }
        public string Site { get; set; }
        public string DomainUri { get; set; }
        public string Owner { get; set; }
        public string Controller { get; set; }
        public string Action { get; set; }
        public string QueryString { get; set; }
        public string IdentityName { get; set; }
        
        public override string ToString()
        {
            return string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}", DomainUri, Site, Area, Owner, Controller, Action, IdentityName, QueryString);
        }
    }
}